﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace BLL
{
    public class SubscribesBLL
    {
        SubscribesDAL sd = new SubscribesDAL();
        //获取关注用户信息
        public DataSet getSubsUsers(int groupid)
        {
            DataSet ds = sd.getSubs(groupid);
            return ds;
        }
        //添加关注用户信息
        public bool addSubsUser(string subscribe, string openid, string nickname, string sex, string language, string city, string province, string country, string headimgurl, string subscribe_time, string unionid, string remark, string groupid)
        {
            subscribe_time = FormatTimeBLL.formatTime(subscribe_time);
            int i = sd.addSubs(Int32.Parse(subscribe), openid, nickname, sex, language, city, province, country, headimgurl, subscribe_time, unionid, remark, Int32.Parse(groupid));
            if (i == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        //删除关注用户信息
        public bool delSubsUser(string openid)
        {
            int i = sd.delSubs(openid);
            if (i == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        //根据用户名称查找关注用户
        public DataSet getSubsUser(string nickname)
        {
            return sd.getSubsUser(nickname);
        }
        //批量插入
        public void synchroSubUsers(string table,DataTable dt)
        {
            sd.synchroSubs(table,dt);
        }
    }
}
